package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class IODemo3 {
    public static void main(String[] args) throws IOException {
        try (InputStream inputStream = new FileInputStream("f:/test.txt")) {
            // 读文件操作
            // read 一次返回一个字节，但是此处的返回值类型是 int
            while (true){
                int b = inputStream.read();
                if (b == -1){
                    // 读到末尾
                    break;
                }
                System.out.println(b);
            }
        }
    }
}
